<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <meta http-equiv="x-ua-compatible" content="ie=7" />
        <title>修改车型</title>
        <link href="{:C('WEB_URL')}Public/admin/style/base.css" rel="stylesheet" type="text/css" />
        <link href="{:C('WEB_URL')}Public/admin/style/master.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="{:C('WEB_URL')}Public/admin/js/jquery1.9.1.js"></script>
        <script type="text/javascript" src="{:C('WEB_URL')}Public/admin/js/base.js"></script>
        <style>
            .peijianList{height:160px;overflow:auto;}
            label{display:inline-block;width:210px;margin-right:20px;}
            li{margin-bottom:5px;}
        </style>
    </head>
    <body>
        <div id="wrapper">
            <h2>修改车型<a href="javascript:history.go(-1)">返回</a></h2>
            <form action="{:U('update_auto')}" method="post" id='myForm' >
                <table class="form" >
                    <tr>
                        <td class="tkey w160">品牌：</td>
                        <td>
                            <select name="brand_id" readonly="readonly">
                                <volist name='auto' id='vo'>
                                    <option <eq name="vo.brand_id" value="$data['brand_id']">selected</eq> value="{$vo.brand_id}">{$vo.brand_name}</option>
                                </volist>
                            </select>
                            <input type="hidden" name="brand_name" value="{$data['brand_name']}" />
                            <input type="hidden" name="brand_logo" value="{$data['brand_logo']}" />
                        </td>
                    </tr>
                    <tr>
                        <td class="tkey">车型：</td>
                        <td><input value="{$data['model_name']}" type="text" name="model_name" class="inputText" readonly="readonly"/></td>
                    </tr>
                    <tr>
                        <td class="tkey">年份：</td>
                        <td><input value="{$data['model_year']}" type="text" name='model_year' class="inputText" readonly="readonly"></td>
                    </tr> 
                    <tr>
                        <td class="tkey">排量：</td>
                        <td><input value="{$data['model_pl']}" type="text" name='model_pl' class="inputText" readonly="readonly"></td>
                    </tr> 
                    <tr>
                        <td class="tkey">车型列表：</td>
                        <td>
                            <ul id="J_autoList">
                                <volist name="autoList" id="vo">
                                <li id="J_autoTpl">
                                    <input type="text" name="auto_name[]" value="{$vo['auto_name']}" placeholder="车型名称 例：2015款 35 TFSI 标准型" class="inputText mr10 w240" />
                                    <input value="{$vo['capacity']}" type="text" name='capacity[]' class="inputText" placeholder="机油量 例：4" />&nbsp;L
                                    <input value="{$vo['model_id']}" type="hidden" name='model_id[]' />
                                </li>
                                </volist>
                            </ul>
                            <a href="javascript:void(0)" onclick="addAuto.add()">＋增加车型</a>
                        </td>
                    </tr>

                    <tr>
                        <td class="tkey">机滤：</td>
                        <td>
                            <div class="peijianList">
                                <volist name="jilv" id="vo">
                                    <label>
                                        <input type="checkbox" name="jilv[]" value="{$vo['pj_id']}" <php>if(in_array($vo['pj_id'],$peijianIdList[$vo['type_id']])){ echo "checked='checked' ";}</php> />{$vo['pj_pinpai']}&nbsp;{$vo['pj_xinghao']}
                                        <span class="fc-f60">*{$vo['count']}</span>
                                    </label>
                                </volist>
                            </div>
                        </td>
                    </tr>

                    <tr>
                        <td class="tkey">空调滤：</td>
                        <td>
                            <div class="peijianList">
                                <volist name="kongtiaolv" id="vo">
                                    <label><input type="checkbox" name="kongtiaolv[]" value="{$vo['pj_id']}" <php>if(in_array($vo['pj_id'],$peijianIdList[$vo['type_id']])){ echo "checked='checked' ";}</php>  />{$vo['pj_pinpai']}&nbsp;{$vo['pj_xinghao']}<span class="fc-f60">*{$vo['count']}</span></label>
                                </volist>
                            </div>
                        </td>
                    </tr>

                    <tr>
                        <td class="tkey">空气滤：</td>
                        <td>
                            <div class="peijianList">
                                <volist name="kongqilv" id="vo">
                                    <label><input type="checkbox" name="kongqilv[]" value="{$vo['pj_id']}" <php>if(in_array($vo['pj_id'],$peijianIdList[$vo['type_id']])){ echo "checked='checked' ";}</php> />{$vo['pj_pinpai']}&nbsp;{$vo['pj_xinghao']}<span class="fc-f60">*{$vo['count']}</span></label>
                                </volist>
                            </div>
                        </td>
                    </tr>

                    <tr>
                        <td class="tkey">火花塞：</td>
                        <td>
                            <div class="peijianList">
                                <volist name="huohuasai" id="vo">
                                    <label><input type="checkbox" name="huohuasai[]" value="{$vo['pj_id']}" <php>if(in_array($vo['pj_id'],$peijianIdList[$vo['type_id']])){ echo "checked='checked' ";}</php> />{$vo['pj_pinpai']}&nbsp;{$vo['pj_xinghao']}<span class="fc-f60">*{$vo['count']}</span></label>
                                </volist>
                            </div>
                        </td>
                    </tr>
                     
                    <tr>
                        <td class="tkey"></td>
                        <td><input type="button" value="确定"  class="btnOrange" onclick="addAuto.submit()" /></td>
                    </tr>
                </table>
            </form>
        </div>
		<script type="text/javascript">
		    var addAuto={

                tpl:'<input type="text" name="auto_name[]" placeholder="车型名称 例：2015款 35 TFSI 标准型" class="inputText mr10 w240" />'+
                    '<input type="text" name="capacity[]" class="inputText" placeholder="机油量 例：4" />&nbsp;L',
                btnMinus:'<a href="javascript:void(0)" onclick="addAuto.minus(this)">－删除</a>',
                init:function(){

                },
                add:function(){
                    var _t=this,
                        html="<li>"+_t.tpl+_t.btnMinus+"</li>";
                        
                    $("#J_autoList").append(html);
                },
                minus:function(e){
                    $(e).parent("li").remove();
                },

                submit:function(){
                    $("#myForm").find("input[type='text']").each(function(){
                        var val=$(this).val();
                        if(val==""){
                            alert("请输入相应数值");
                            $(this).focus();
                            return false;
                        }else{
                            $(this).val($.trim(val.toUpperCase()));
                        }
                    })

                    $("#myForm").submit();

                }
           }
           
           addAuto.init();
		</script>
    </body>
</html>